﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:conv="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Converters"
                    xmlns:cmenu="clr-namespace:Tum.PDE.ToolFramework.Modeling.Visualization.Controls.ContextMenu">

    <conv:MenuIconConverter x:Key="MenuIconUrlConv"/>

    <Style TargetType="{x:Type MenuItem}" x:Key="MenuItemStyle">
        <Setter Property="MenuItem.Header" Value="{Binding Text}"/>
        <Setter Property="MenuItem.ItemsSource" Value="{Binding Children}"/>
        <Setter Property="MenuItem.Command" Value="{Binding Command}" />
        <Setter Property="MenuItem.CommandParameter" Value="{Binding CommandParameter}" />
        <Setter Property="MenuItem.IsEnabled" Value="{Binding IsEnabled}" />
        <Setter Property="MenuItem.Icon" Value="{Binding IconUrl, Converter={StaticResource MenuIconUrlConv}}"/>
    </Style>
    <Style x:Key="SeparatorStyleForContextMenu" TargetType="{x:Type Separator}">
        <Setter Property="Height" Value="1"/>
        <Setter Property="Margin" Value="0,0,0,0"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Separator">
                    <Border BorderBrush="#888" BorderThickness="1" Margin="0, 4, 0, 4"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style TargetType="{x:Type MenuItem}" x:Key="MenuItemSeparatorStyle">
        <Setter Property="Margin" Value="0,4,0,4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type MenuItem}">
                    <Border Margin="28,0,0,0" BorderThickness="1" Height="1.0" BorderBrush="Silver" IsEnabled="False" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <cmenu:ContextMenuStyleSelector x:Key="ContextMenuItemStyleSelector" MenuItemStyle="{StaticResource MenuItemStyle}" MenuItemSeparatorStyle="{StaticResource MenuItemSeparatorStyle}"/>

</ResourceDictionary>